Skip to content

Conversation

@rpallavisharma
Copy link
Member

@rpallavisharma rpallavisharma commented Nov 7, 2025

User description

Thanks for contributing to the Selenium site and documentation!
A PR well described will help maintainers to review and merge it quickly

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, and help reviewers by making them as simple and short as possible.

Added information of Get Dom Property and Get Dom Attribute.
Provided code for java, added for all languages

Description

Added information of Get Dom Property and Get Dom Attribute.
Provided code for java, added for all languages

Motivation and Context

information about these methods were missing

Types of changes

  • Change to the site (I have double-checked the Netlify deployment, and my changes look good)
  • Code example added (and I also added the example to all translated languages)
  • Improved translation
  • Added new translation (and I also added a notice to each document missing translation)

Checklist

  • I have read the contributing document.
  • I have used hugo to render the site/docs locally and I am sure it works.

PR Type

Documentation, Enhancement


Description

  • Added getDomProperty() and getDomAttribute() method documentation

  • Implemented Java test examples for both new methods

  • Updated documentation across multiple language versions (English, Japanese, Portuguese, Chinese)

  • Reorganized section header from "Fetching Attributes or Properties" to "Fetching Attributes and Properties"


Diagram Walkthrough

flowchart LR
  A["Java Test Examples"] -->|"getDomProperty & getDomAttribute"| B["Documentation Files"]
  B -->|"Updated"| C["EN, JA, PT-BR, ZH-CN"]
  C -->|"Added"| D["New Method Sections"]
Loading

File Walkthrough

Relevant files
Tests
InformationTest.java
Add getDomProperty and getDomAttribute test examples         

examples/java/src/test/java/dev/selenium/elements/InformationTest.java

  • Added test code for getDomProperty("value") method
  • Added test code for getDomAttribute("value") method
  • Both methods retrieve the same value from email input element
  • Assertions verify correct values are returned
+7/-0     
Documentation
information.en.md
Add DOM property and attribute method documentation           

website_and_docs/content/documentation/webdriver/elements/information.en.md

  • Changed section header to "Fetching Attributes and Properties"
  • Added subsection "Get Attribute" for existing getAttribute
    documentation
  • Added new subsection "Get Dom Property" with Java code example
    reference
  • Added new subsection "Get Dom Attribute" with Java code example
    reference
  • Included placeholder tabs for Python, CSharp, Ruby, JavaScript, and
    Kotlin
+55/-1   
information.ja.md
Add DOM property and attribute documentation in Japanese 

website_and_docs/content/documentation/webdriver/elements/information.ja.md

  • Changed section header to "Fetching Attributes and Properties"
  • Added subsection "Get Attribute" for existing getAttribute
    documentation
  • Added new subsection "Get Dom Property" with Java code example
    reference
  • Added new subsection "Get Dom Attribute" with Java code example
    reference
  • Fixed Kotlin tab formatting and included placeholder tabs for other
    languages
+56/-3   
information.pt-br.md
Add DOM property and attribute documentation in Portuguese

website_and_docs/content/documentation/webdriver/elements/information.pt-br.md

  • Changed section header to "Fetching Attributes and Properties"
  • Added subsection "Get Attribute" for existing getAttribute
    documentation
  • Added new subsection "Get Dom Property" with Java code example
    reference
  • Added new subsection "Get Dom Attribute" with Java code example
    reference
  • Updated code block path references and fixed tab formatting
+58/-6   
information.zh-cn.md
Add DOM property and attribute documentation in Chinese   

website_and_docs/content/documentation/webdriver/elements/information.zh-cn.md

  • Added new subsection "Get Dom Property" with Java code example
    reference
  • Added new subsection "Get Dom Attribute" with Java code example
    reference
  • Included placeholder tabs for Python, CSharp, Ruby, JavaScript, and
    Kotlin
  • Appended sections at end of existing documentation
+52/-0   

@qodo-merge-pro
Copy link
Contributor

qodo-merge-pro bot commented Nov 7, 2025

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status:
No auditing: The added code performs element property/attribute reads and assertions without any
logging or audit trail, though this may be acceptable for test/example code.

Referred Code
// Fetch Dom Property
String propInfo = emailTxt.getDomProperty("value");
assertEquals(propInfo,"admin@localhost");

// Fetch Dom Attribute
String attrInfo = emailTxt.getDomAttribute("value");
assertEquals(attrInfo,"admin@localhost");
Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
No error handling: The new example code uses direct assertions and WebDriver calls without explicit error
handling for potential failures, which may be acceptable in test snippets but lacks
robustness.

Referred Code
// Fetch Dom Property
String propInfo = emailTxt.getDomProperty("value");
assertEquals(propInfo,"admin@localhost");

// Fetch Dom Attribute
String attrInfo = emailTxt.getDomAttribute("value");
assertEquals(attrInfo,"admin@localhost");
  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-merge-pro
Copy link
Contributor

qodo-merge-pro bot commented Nov 7, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
High-level
Provide complete and clarifying documentation

The PR is incomplete as it only provides Java code examples, leaving other
languages empty. Additionally, the documentation and examples fail to clarify
the key differences between getAttribute, getDomProperty, and getDomAttribute,
which should be addressed with a better example for all supported languages.

Examples:

website_and_docs/content/documentation/webdriver/elements/information.en.md [288-337]
### Get Dom Property 

This method retrieves the value of a specific DOM property of a web element.

{{< tabpane langEqualsHeader=true >}}
{{< tab header="Java" text=true >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L67-L69" >}}
{{< /tab >}}
  {{< tab header="Python" text=true >}}


 ... (clipped 40 lines)
examples/java/src/test/java/dev/selenium/elements/InformationTest.java [67-73]
      // Fetch Dom Property
      String propInfo = emailTxt.getDomProperty("value");
      assertEquals(propInfo,"admin@localhost");

      // Fetch Dom Attribute
      String attrInfo = emailTxt.getDomAttribute("value");
      assertEquals(attrInfo,"admin@localhost");

Solution Walkthrough:

Before:

// In InformationTest.java
WebElement emailTxt = driver.findElement(By.name(("email_input")));

// All three methods return the same value in this example
String valueInfo = emailTxt.getAttribute("value"); // "admin@localhost"
String propInfo = emailTxt.getDomProperty("value"); // "admin@localhost"
String attrInfo = emailTxt.getDomAttribute("value"); // "admin@localhost"

// In information.en.md
// ...
// {{< tab header="Python" text=true >}}
//   <!-- Empty -->
// {{< /tab >}}
// ...

After:

// In documentation, explain the difference:
// `getDomAttribute` returns the HTML attribute value as a string.
// `getDomProperty` returns the current property value, which can be of a different type (e.g., boolean).

// Example with a checkbox where attribute and property differ:
// HTML: <input type="checkbox" id="cb" checked>
WebElement checkbox = driver.findElement(By.id("cb"));

String attribute = checkbox.getDomAttribute("checked"); // "true" or ""
boolean property = checkbox.getDomProperty("checked"); // true

// After unchecking the box via UI:
// attribute remains "true" or ""
// property becomes false

// All language tabs in markdown files should be filled with similar examples.
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies that the PR is incomplete (missing examples for most languages) and that the provided example fails to demonstrate the crucial differences between getAttribute, getDomProperty, and getDomAttribute, which is the main point of the new documentation.

High
General
Improve test to show method differences

Improve the test case to demonstrate the behavioral differences between
getDomProperty and getDomAttribute by modifying an input's value and asserting
the distinct results from each method.

examples/java/src/test/java/dev/selenium/elements/InformationTest.java [67-73]

-// Fetch Dom Property
-String propInfo = emailTxt.getDomProperty("value");
-assertEquals(propInfo,"admin@localhost");
+// Get number input
+WebElement numberInput = driver.findElement(By.name("number_input"));
+assertEquals("4", numberInput.getDomAttribute("value"));
 
-// Fetch Dom Attribute
-String attrInfo = emailTxt.getDomAttribute("value");
-assertEquals(attrInfo,"admin@localhost");
+// Type a new value
+numberInput.sendKeys("5");
 
+// Get attribute value
+assertEquals("4", numberInput.getDomAttribute("value"));
+
+// Get property value
+assertEquals("45", numberInput.getDomProperty("value"));
+
  • Apply / Chat
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies that the added test case fails to demonstrate the key difference between getDomProperty and getDomAttribute, and proposes a much better test that clearly illustrates their distinct behaviors, which is critical for documenting this new feature.

High
  • Update

@netlify
Copy link

netlify bot commented Nov 7, 2025

Deploy Preview for selenium-dev ready!

Name Link
🔨 Latest commit c93e12b
🔍 Latest deploy log https://app.netlify.com/projects/selenium-dev/deploys/692793d4dd68250008e92f7d
😎 Deploy Preview https://deploy-preview-2529--selenium-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@rpallavisharma
Copy link
Member Author

The tests failure doesn't look related to this PR. Kindly check this.

@rpallavisharma rpallavisharma requested a review from diemol November 7, 2025 11:02
@rpallavisharma
Copy link
Member Author

rpallavisharma commented Nov 26, 2025

@harsha509 / @diemol i am bringing the conversation here. You are saying that the existing definition of GetAttribute should be updated to reflect that why two new methods would be needed. And i am saying that i haven't changed that detail, but added new and this PR should be evaluated on that basis.

I will tell you reasoning, you can then think and decide to take this forward.

Get Attribute method as pre existing has translation done in other spoken languages, zh-cn file check that.

I changing the text to what you mentioned in the PR, will require me to also add the same in english for chinese, and i don't know that language, at the most i can guess it is line number - 249 in the zh-cn file where get attribute was previously explained.

Moving forward here i see how to take this to closure -

a. i update Get Attribute(in english) in all files, except chinese translation.
b. i update Get Attribute in all files(in english) also zh-cn one provided you confirm the line numbers.
c. This PR gets accepted knowing that this was made with intention to add information for two new methods and not change existing one.

Please choose which option is workable here to proceed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants